//
//  ViewController.m
//  UI28_target_action
//
//  Created by Scott on 16/1/20.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "ViewController.h"
#import "TouchView.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self createView];
}

#pragma mark - 自定义View
- (void)createView {
    
    TouchView *view = [[TouchView alloc] initWithFrame:CGRectMake(20, 50, 100, 50)];
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
    
    // target和action赋值.
    [view addTarget:self action:@selector(handleClicked:)];
}


- (void)handleClicked:(TouchView *)view {
    
    NSLog(@"dd");
    
}


#pragma mark -
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
